# -*- coding: UTF-8 -*-
import json
import sys
import time

behavior = {
    'parse': '其他功能',
    'getMacAddress': '获取设备MAC地址',
    'getImei': '获取设备IMEI码',
    'getLine1Number': '获取手机号',
    'getDeviceId': '获取设备ID码',
    'getSubscriberId': '获取设备IMSI码',
    'getHardwareAddress': '获取设备IP地址',
    'getCameraCharacteristics': '获取摄像头',
    'requestLocationUpdates': '获取更新位置信息',
    'getLastKnownLocation': '获取位置信息',
    'startRecording': '获取录音功能',
    'test': '测试'}

sdk_dic = {
        '遨游代理': ['com.maxthon.main', 'com.maxthon.proxy.'],
        '逸创云客服sdk': ['com.chosen.kf5sdk'],
        '迅雷下载SDK': ['com.xunlei.download.APP_KEY'],
        '迅雷vodplayer': ['com.xunlei.yueyangvod'],
        '豹趣小游戏': ['com.cmcm.cmgame', 'com.cmcm.gamemoney_sdk'],
        '谷歌统计': ['com.google.android.gms.analytics', 'com.google.analytics'],
        '谷歌服务框架': ['com.google.android.gms'],
        '谷歌应用内购': ['com.google.android.play.billingclient.', 'com.google.android.gms.ads.purchase.InAppPurchaseActivity'],
        '谷歌地图sdk': ['com.google.android.gms.maps','com.google.android.geo.API_KEY','com.google.android.maps'],
        '谷歌 文字转语音': ['com.google.android.tts.', 'android.speech.tts'],
        '谷歌 sample': ['com.google.sample.'],
        '谷歌 datatransport': ['com.google.android.datatransport'],
        '谷歌 VR': ['com.google.vr.'],
        '谷歌 FireBase': ['com.google.firebase.'],
        '谷歌 Cardboard': ['com.google.vrtoolkit.cardboard'],
        '诸葛IO': ['com.zhuge.analysis'],
        '讯飞开放平台': ['com.iflytek'],
        '融云IM': ['io.rong.imlib', 'io.rong.imkit'],
        '蜻蜓FM': ['com.qingting.','qingting.qingting.fm','qingting.open.appid'],
        '蒲公英内测': ['com.pgyersdk'],
        '芝麻认证': ['com.megvii.zhimasdk'],
        '腾讯QQ登录': ['oicq.wlogin_sdk.'],
        '腾讯阅读': ['cooperation.qqreader'],
        '腾讯统计': ['com.tencent.stat'],
        '腾讯游戏': ['com.tencent.gps.cloudgame', 'com.tencent.game', 'com.tencent.gamecenter'],
        '腾讯智能设备': ['cooperation.smartdevice', 'com.tencent.device.'],
        '腾讯时光': ['com.tencent.ipai'],
        '腾讯推送': ['com.tencent.android.vivopush','com.tencent.android.hwpush','com.tencent.android.xg.', 'com.tencent.tpns','com.tencent.android.mipush', 'com.tencent.android.mzpush','com.tencent.component.thirdpartypush'],
        '腾讯微博sdk': ['com.tencent.weibo.sdk'],
        '腾讯应用助手': ['com.qq.AppService.', 'com.connector.qq.AppService'],
        '腾讯地图定位SDK': ['com.tencent.map.geolocation'],
        '腾讯地图Android SDK': ['com.tencent.map', 'com.tencent.tencentmap'],
        '腾讯图片选择': ['com.tencent.picker.'],
        '腾讯动漫': ['cooperation.comic'],
        '腾讯信鸽推送收费版': ['com.tencent.android.tpush.service.XGVipPushService', 'com.tencent.android.xg.vip.'],
        '腾讯信鸽推送': ['com.tencent.rdm.uuid', 'com.tencent.android.tpush'],
        '腾讯云通信sdk': ['com.tencent.qalsdk', 'com.tencent.qalsdk.service'],
        '腾讯云滑块验证码': ['com.tencent.captchasdk'],
        '腾讯云智营防劫持sdk': ['com.tencent.msdk.dns'],
        '腾讯云小薇': ['com.tencent.xiaowei.sdk'],
        '腾讯云反馈': ['com.tencent.feedback.'],
        '腾讯云Iot': ['com.tencent.iot'],
        '腾讯云': ['com.tencent.cloud'],
        '腾讯qq扫一扫': ['com.tencent.qbardemo.'],
        '腾讯X5浏览服务推送': ['com.tencent.mtt.browser.push.'],
        '腾讯X5Web': ['com.tencent.xweb','com.tencent.smtt.','com.tencent.mtt.', 'com.tencent.webview'],
        '腾讯Tinker': ['com.tencent.tinker'],
        '腾讯TME live': ['com.tme.component', 'com.tme.mlive.'],
        '腾讯TMAssistant SDK': ['com.tencent.tmassistantagentsdk', 'com.tencent.tmassistantsdk.downloadservice'],
        '腾讯QQ钱包': ['cooperation.qwallet.'	,'com.tencent.mobileqq.activity.qwallet.', 'com.tencent.midas.qq.APReidasQQWalletActivity', 'com.tencent.midas.'],
        '腾讯QQ邮箱': ['com.tencent.qqmail.'],
        '腾讯QQ空间': ['cooperation.qzone.'],
        '腾讯QQ互联': ['com.tencent.qqconnect','com.tencent.tauth','com.tencent.connect'],
        '腾讯MTA': ['com.tencent.mid.api.MidProvider', 'com.mta.checker.'],
        '腾讯MQTT': ['com.tencent.bigdata', 'com.tencent.bigdata.mqttchannel'],
        '腾讯Dov': ['dov.com.qq.'],
        '腾讯Bugly': ['com.tencent.bugly'],
        '腾讯 wifi': ['com.tencent.wifisdk'],
        '腾讯 pangu': ['com.tencent.pangu'],
        '腾讯 moai': ['com.tencent.moai.','moai.patch.','moai.ocr.', 'moai.daemon.'],
        '腾讯 WebNet': ['com.tencent.webnet'],
        '腾讯 WNS': ['com.tencent.wns.'],
        '联通登录': ['com.sdk.mobile.manager.login.cucc'],
        '联动优势': ['com.umpay.creditcard.android'],
        '美洽移动应用 SDK': ['com.meiqia.meiqiasdk.', 'com.meiqia.core'],
        '美图sdk': ['com.meitu.mp.sdk'],
        '美团hydra': ['com.meituan.hydra'],
        '网易支付': ['com.netease.epay.'],
        '网易推送': ['com.netease.pushservice.'],
        '移动登录': ['com.cmic.sso.'],
        '移动SDK支付': ['mm.sms.purchasesdk.', 'mm.purchasesdk'],
        '神策数据': ['com.sensorsdata.analytics.'],
        '百度钱包': ['com.baidu.wallet','com.baidu.poly','com.baidu.paysdk', 'com.baidu.android.pay', 'com.baidu.wallet.paysdk'],
        '百度语音': ['com.baidu.tts.'],
        '百度自动更新': ['com.baidu.autoupdatesdk'],
        '百度移动统计SDK': ['com.baidu.mobstat'],
        '百度移动推广SDK': ['com.baidu.mobads'],
        '百度游戏': ['com.baidu.gamesdk'],
        '百度昊天SDK': ['com.baidu.haotian.', 'com.baidu.sofire'],
        '百度慧推': ['com.baidu.techain'],
        '百度开发者平台': ['com.baidu.platformsdk'],
        '百度定位': ['com.baidu.location'],
        '百度多酷': ['com.duoku.platform', 'com.duoku.platform.push'],
        '百度地图': ['com.baidu.mapapi','com.baidu.cesium','com.baidu.cesium.ver'],
        '百度云语音': ['com.baidu.voicerecognition.android'],
        '百度云推送': ['com.baidu.android.pushservice'],
        '百度云sdk': ['com.baidu.android.imsdk', 'com.baidu.cloudsdk'],
        '百度webkit': ['com.baidu.webkit.sdk'],
        '百度swan': ['com.baidu.swan'],
        '百度helios': ['com.baidu.helios'],
        '百度Titan': ['com.baidu.titan.'],
        '百度SAP': ['com.baidu.sapi2'],
        '百度Pyramid': ['com.baidu.pyramid'],
        '百度GreedyPorter(GPT)': ['com.baidu.gpt.'],
        '百度Android全景SDK': ['com.baidu.lbsapi'],
        '百度 UfoSDK': ['com.baidu.ufosdk'],
        '现在支付': ['com.ipaynow.plugin'],
        '环信推送SDK': ['com.hyphenate.push.'],
        '环信坐席端SDK': ['com.easemob.chat.','com.easemob.videocall','com.easemob.kefu.', 'com.hyphenate.chat.'],
        '环信 TC-IM': ['com.hyphenate.liveroom'],
        '环信 EaseUI': ['com.hyphenate.easeui'],
        '爱贝云计费': ['com.iapppay'],
        '滴滴出行sdk': ['com.sdu.didi.openapi'],
        '淘宝推送': ['com.taobao.agoo', 'com.taobao.accs.'],
        '淘宝扫一扫': ['com.taobao.taobao.scancode.'],
        '淘宝 tlog': ['com.taobao.android.tlog.'],
        '淘宝 minivideo': ['com.taobao.android.minivideo.'],
        '淘宝 miniimage': ['com.taobao.android.miniimage'],
        '淘宝 Atlas': ['android.taobao.atlas.'],
        '梆梆 防劫持sdk': ['com.bangcle.antihijack.'],
        '极光推送': ['cn.jpush.yyb.','cn.jpush.client','cn.jpush.reactnativejpush.', 'cn.jpush.android.ui.Push', 'cn.jpush.android', 'cn.jpush.android.api'],
        '有赞': ['com.youzan.mobile'],
        '暴风魔镜': ['com.baofeng.mojing.sdk.'],
        '智齿客服SDK': ['com.sobot.chat'],
        '易观方舟': ['com.eguan.drivermonitor', 'com.eguan.monitor'],
        '易宝支付': ['com.yeepay.android.plugin'],
        '易信': ['yxapi.AppRegister','im.yixin.sdk','yxapi.YXEntryActivity'],
        '旷视人脸认证': ['com.megvii.meglive_sdk'],
        '时光相册': ['everphoto.component.', 'everphoto.'],
        '新浪微博开放平台': ['com.sina.push', 'com.sina.weibo.sdk'],
        '支付宝支付': ['com.alipay.sdk.auth','com.alipay.android.app.pay','com.alipay.sdk', 'com.alipay.sdk.app'],
        '支付宝扫一扫': ['com.alipay.mobile.scan.', 'com.alipay.mobile.scansdk.'],
        '支付宝开放平台': ['com.alibaba.alipay','com.alipay.android.app.','com.alipay.android.app.sdk', 'com.alipay.android.mini'],
        '支付宝小程序': ['com.alipay.mobile.tinyappcustom'],
        '支付宝 Nebula': ['com.alibaba.sdk.android.webview.', 'com.alipay.android.nebulaapp.'],
        '搜狗语音云': ['com.sogou.speech.'],
        '搜狗passport': ['com.sogou.passportsdk'],
        '指易付': ['com.skymobi.pay'],
        '招商一网通支付': ['cmbapi.CMBApiEntryActivity','com.cmbchina.pb.','.CMBApiEntryActivity'],
        '拉卡拉支付': ['com.lkl.pay.'],
        '手盟SDK': ['com.sdklm.shoumeng.'],
        '微猫sdk': ['cn.wemart.sdk'],
        '微派支付': ['com.bx.pay'],
        '微信支付': ['com.tencent.mm.sdk', '.BCWechatPaymentActivity', '.wxapi.WXPayEntryActivity', 'wxapi.WXEntryActivity'],
        '微信扫一扫': ['com.tencent.mm.plugin.scanner'],
        '微信刷脸支付': ['com.tencent.wxpay.imagefacesign.', 'com.tencent.wxpayface.'],
        '当乐游戏开放平台': ['com.downjoy.'],
        '开源弹幕引擎·烈焰弹幕使': ['master.flame.danmaku'],
        '建行龙支付': ['com.ccb.pay.loongpay', 'com.ccb.loongwealth'],
        '广升(Adups):FOTA升级': ['adups.smartdevice.fota'],
        '小米推送': ['com.xiaomi.push','.MiPUSH','com.xiaomi.mipush'],
        '小米应用商店sdk': ['com.xiaomi.market.sdk'],
        '小米帐号开放平台': ['com.xiaomi.accounts', 'com.xiaomi.account.openauth'],
        '小米 passport': ['com.xiaomi.passport'],
        '小米 VR': ['com.mi.dlabs.component','com.xiaomi.vr.','com.mi.dlabs.vr.'],
        '安天 AVL': ['com.avl.engine.', '.AVLScanService'],
        '天翼账号SDK': ['cn.com.chinatelecom.account.'],
        '大众点评推送': ['com.dianping.base.push'],
        '图片选择 & 图片预览 & 图片加载相关': ['com.daimajia.slider.library','com.bumptech.glide', 'de.hdodenhof.circleimageview', 'me.iwf.photopicker', 'in.srain.cube', 'com.dmcbig.mediapicker', 'com.darsh.multipleimageselect.'],
        '喜马拉雅FM sdk': ['com.ximalaya.ting.android.opensdk'],
        '听云': ['com.networkbench.com'],
        '叮当APP自助生成平台': ['com.dingdone.'],
        '友盟自动更新': ['com.umeng.update'],
        '友盟统计分析平台': ['com.umeng.analytics'],
        '友盟组件': ['com.umeng.common'],
        '友盟社会化组件': ['com.umeng.socialize'],
        '友盟游戏统计分析': ['com.umeng.analytics.game'],
        '友盟推送': ['com.umeng.message'],
        '友盟反馈': ['com.feedback.ui', 'com.umeng.fb', 'com.mobclick.android.UmengFeedback'],
        '华为账户登录认证': ['com.huawei.hms.activity'],
        '华为游戏中心sdk': ['com.huawei.hwid20'],
        '华为支付': ['com.huawei.pay.ui'],
        '华为推送': ['com.huawei.agconnect.core','com.huawei.android.pushselfshow', 'com.huawei.push.', 'com.huawei.updatesdk', 'com.huawei.android.pushagent', 'com.huawei.intent.action.PUSH_STATE', 'com.huawei.intent.action.PUSH'],
        '华为HMS': ['com.huawei.android.hms.agent','com.huawei.hms.client', 'com.huawei.hms', 'com.huawei.hms.aaid', 'com.huawei.hms.support.api.push', 'com.huawei.hms.update', 'com.huawei.hms.support.api.push.PushEventReceiver'],
        '华为 AR Engine': ['com.huawei.ar.engine'],
        '创蓝闪验': ['com.chuanglan.shanyan_sdk'],
        '仿iOS的PickerView控件': ['com.bigkoo.pickerview'],
        '人脸识别': ['com.swwx.facesdk'],
        '人人网登录': ['com.renn.rennsdk.oauth'],
        '京东支付': ['com.jdpay.paymentcode','com.jd.lib.jdpaygeneral','com.jdpaysdk.payment', 'com.jd.lib.jdpaysdk', 'com.jdpaysdk.author', 'com.wangyin.payment.jdpaysdk'],
        '京东推送': ['com.jingdong.jdpush_new'],
        '京东开普勒': ['com.kepler.jd.'],
        '乐视支付': ['com.letv.lepaysdk'],
        '乐视手游': ['com.le.legamesdk'],
        '乐视云': ['com.letvcloud.cmf'],
        '乐播投屏': ['com.hpplay.sdk'],
        '中国移动 AOE': ['com.cmcc.aoe'],
        '个推一键登录': ['com.getui.gtc', 'com.geetest.onelogin'],
        '个推': ['com.igexin.download','com.g.gysdk','com.igexin.getuiext', 'com.igexin.sdk'],
        '万普支付': ['com.wanpu.pay'],
        '一直播': ['tv.xiaoka.base','tv.xiaoka.weibo','tv.xiaoka.publish', 'tv.xiaoka.live', 'tv.xiaoka.play'],
        '一下': ['com.yixia.'],
        'zip4j': ['net.lingala.zip4j'],
        'zBarLibary': ['cn.bertsir.zbar'],
        'xmcontainer': ['com.linfaxin.xmcontainer'],
        'xk_sup': ['com.xk.sup'],
        'xUtils': ['org.xutils'],
        'volley': ['com.android.volley'],
        'viewpagerindicator': ['com.viewpagerindicator'],
        'universalimageloader': ['com.nostra13.universalimageloader'],
        'uls': ['com.uxin.ulslibrary'],
        'uCrop': ['com.yalantis.ucrop'],
        'twitter_sdk': ['com.twitter.sdk.'],
        'tray': ['net.grandcentrix.tray'],
        'termux': ['com.termux.app.'],
        'systembartint': ['com.readystatesoftware.systembartint'],
        'swipemenulistview': ['com.baoyz.swipemenulistview'],
        'stickygridheaders': ['com.tonicartos.widget.stickygridheaders'],
        'snappydb': ['com.snappydb'],
        'senab_photoview': ['uk.co.senab.photoview'],
        'securepreferences': ['com.securepreferences'],
        'scalablevideoview': ['com.yqritc.scalablevideoview'],
        'roundedimageview': ['com.makeramen.roundedimageview'],
        'robobinding': ['org.robobinding'],
        'recyclerviewheader2': ['com.bartoszlipinski.recyclerviewheader'],
        'rebound': ['com.facebook.rebound'],
        'react-native异常处理库': ['com.masteratul.exceptionhandler'],
        'pulltorefresh': ['com.handmark.pulltorefresh'],
        'picasso': ['com.squareup.picasso'],
        'paypal': ['com.paypal.android.sdk','io.card.payment','com.paypal.android.'],
        'otto': ['com.squareup.otto'],
        'orhanobut_logger': ['com.orhanobut.logger'],
        'oksdk': ['com.lk.sdk'],
        'okhttp3': ['okhttp3'],
        'okhttp': ['com.squareup.okhttp'],
        'nineoldandroids': ['com.nineoldandroids'],
        'music player': ['com.wang.avi'],
        'mikephil_charting': ['com.github.mikephil.charting'],
        'materialdialogs': ['com.afollestad.materialdialogs'],
        'materialdatetimepicker': ['com.wdullaer.materialdatetimepicker'],
        'luck_picture': ['com.luck.picture'],
        'loopj_android-async-http': ['com.loopj.android.http'],
        'litepal_SQLite': ['org.litepal'],
        'listviewanimations': ['com.nhaarman.listviewanimations'],
        'junit': ['junit.framework'],
        'jobdispatcher': ['com.firebase.jobdispatcher'],
        'joanzapata_pdfview': ['com.joanzapata.pdfview'],
        'jeremyfeinstein_slidingmenu': ['com.jeremyfeinstein.slidingmenu.lib'],
        'javiersantos_PiracyChecker': ['com.github.javiersantos.piracychecker.'],
        'javapoet': ['com.squareup.javapoet'],
        'jackpal_androidterm': ['jackpal.androidterm.Term', 'jackpal.androidterm'],
        'ixintui 推送': ['com.ixintui.push'],
        'ironSource': ['com.ironsource.sdk.'],
        'innosystec_unrar': ['de.innosystec.unrar'],
        'imagezoom': ['it.sephiroth.android.library.imagezoom'],
        'image management': ['com.facebook.cache.common', 'com.facebook.imagepipeline'],
        'iProtect网银安全服务': ['cn.cloudcore.iprotect'],
        'iBank': ['com.nantian.iBank'],
        'huewu_listview': ['com.huewu.pla.lib'],
        'greenEventBus': ['de.greenrobot.event'],
        'greenDAO': ['de.greenrobot.dao'],
        'facebook_crypto': ['com.facebook.crypto'],
        'expandabletextview': ['com.ms.square.android.expandabletextview'],
        'eventbus': ['org.simple.eventbus'],
        'epay支付': ['com.boc.epay'],
        'emojicon': ['com.rockerhieu.emojicon'],
        'dropbox': ['com.dropbox.core','com.dropbox.client2.android','com.dropbox.sync'],
        'displaying animated GIF': ['pl.droidsonroids.gif'],
        'device_yearclass': ['com.facebook.device.yearclass'],
        'daimajia_numberprogressbar': ['com.daimajia.numberprogressbar'],
        'dagger': ['dagger'],
        'condom': ['com.oasisfeng.condom.'],
        'cling': ['org.teleal.cling.'],
        'bundletool': ['shadow.bundletool'],
        'bigkoo_convenientbanner': ['com.bigkoo.convenientbanner'],
        'auto-scroll circular parallax ListViews.': ['it.sephiroth.android.library'],
        'androidannotations': ['org.androidannotations.annotations'],
        'andexert': ['com.andexert.library'],
        'agoo': ['org.android.agoo.accs.','org.android.agoo','com.android.agoo.'],
        'achartengine': ['org.achartengine'],
        'ZXing': ['com.stone.zxing.','com.uuzuche.lib_zxing','com.zijunlin.zxing', 'com.google.zxing'],
        'XQRCode': ['com.xuexiang.xqrcode.'],
        'XCL-Charts': ['org.xclcharts'],
        'Wps': ['cn.wps.moffice.', 'com.feinnoui.library.wps.'],
        'WorkManager': ['androidx.work.impl.'],
        'WeiboReactNative': ['cn.reactnative.modules.weibo.'],
        'WePay': ['com.wepayplugin', 'com.wangyin.wepay'],
        'WPS mail': ['com.kingsoft.mail.', 'com.kingsoft.email'],
        'Vungle CN': ['com.vungle.warren.'],
        'Vk': ['com.vk.sdk'],
        'Vivo 推送': ['com.vivo.VivoPushMessageReceiver', 'com.vivo.push'],
        'Vitamio': ['io.vov.vitamio'],
        'VirtualApp': ['io.virtualapp.', 'com.lody.virtual'],
        'ViewPropertyAnimator': ['com.bartoszlipinski.viewpropertyobjectanimator'],
        'UserVoice': ['com.uservoice.uservoicesdk'],
        'Unity3d': ['com.unity3d.player'],
        'Unity-UI': ['unityplayer.UnityActivity','unity.build-id','unityplayer.ForwardNativeEventsToDalvik', 'com.lostpolygon.unity.','unity.splash-enable'],
        'Ultra Pull to Refresh': ['in.srain.cube.views.ptr'],
        'UC插件': ['com.uc.addon.sdk.remote'],
        'Type-safe REST client': ['retrofit2'],
        'Trpay支付': ['com.base.bj.paysdk', 'com.base.bj.trpayjar'],
        'Transitions API': ['com.transitionseverywhere', 'android.support.transition'],
        'TransitionPlayer': ['com.linfaxin.transitionplayer.'],
        'Talkingdata': ['com.talkingdata.sdk'],
        'TODO 通联支付': ['com.allinpay.'],
        'SwipeToLoadLayout': ['com.aspsine.swipetoloadlayout'],
        'SwipeRefreshLayout': ['com.baoyz.widget'],
        'Swipe Layout': ['com.daimajia.swipe'],
        'SwiFTP': ['org.swiftp'],
        'SunPlayer': ['com.player.sunplayer.'],
        'Smack': ['org.jivesoftware.smack'],
        'ShortcutBadger': ['me.leolin.shortcutbadger'],
        'Shizuku': ['moe.shizuku.api.', 'moe.shizuku.client.'],
        'ShareSDK': ['cn.sharesdk'],
        'SenseID 身份验证服务': ['com.sensetime.liveness.', 'com.sensetime.idcard'],
        'SecVerify': ['com.mob.secverify'],
        'SQLCipher': ['net.sqlcipher'],
        'SDL': ['org.libsdl.'],
        'RxJava': ['rx.android'],
        'Realm': ['io.realm'],
        'Rajawali': ['org.rajawali3d'],
        'Qiniu Resource (Cloud)': ['com.qiniu.android'],
        'QQ看点': ['cooperation.qqhotspot.'],
        'ProxyBillingActivity': ['com.android.billingclient.api.ProxyBillingActivity'],
        'Protocol Buffers': ['com.google.protobuf'],
        'PlaylistCore': ['com.devbrackets.android.playlistcore'],
        'Piwik-SDK': ['org.piwik.sdk'],
        'Pinyin4j': ['net.sourceforge.pinyin4j'],
        'Pinterest style ListView': ['me.maxwin'],
        'Ping++ 支付': ['com.pingplusplus'],
        'Payment': ['com.uc.paymentsdk.'],
        'Paymax支付': ['com.swwx.paymax.'],
        'OkDownload': ['com.liulishuo.okdownload'],
        'ORMLite': ['com.j256.ormlite'],
        'OPPO 推送': ['com.coloros.mcssdk', 'com.heytap.mcssdk'],
        'MultiImageChooser': ['com.synconset.MultiImageChooserActivity'],
        'Mob 推送': ['com.mob.tools','com.mob.MobProvider','com.mob.pushsdk.'],
        'Microsoft mmx': ['com.microsoft.mmx', 'com.mmx.microsoft.'],
        'Microsoft feedback': ['com.microsoft.mmx.feedback', 'com.microsoft.office.feedback.'],
        'Microsoft TokenShare': ['com.microsoft.tokenshare.'],
        'Microsoft Notes': ['com.microsoft.notes'],
        'Microsoft Intune': ['com.microsoft.intune.'],
        'Microsoft AAD': ['com.microsoft.identity.', 'com.microsoft.aad.adal'],
        'MessagePack': ['org.msgpack'],
        'Material design ProgressBar': ['me.zhanghai.android.materialprogressbar'],
        'Lottie-Android': ['com.airbnb.lottie.'],
        'LivePush': ['com.live.watermelon','com.live.sync','com.live.push'],
        'LinkedMe': ['linkedme.sdk.key'],
        'Line 分享': ['jp.line.sdk'],
        'Lightspeed Push': ['com.arrownock.push'],
        'LeakCanary': ['com.squareup.leakcanary'],
        'LFilePicker': ['com.leon.lfilepickerlibrary.'],
        'Kakao Talk': ['com.kakao.sdk.AppKey'],
        'Just Keep On Truckin': ['org.ccil.cowan.tagsoup'],
        'Jawbone': ['com.jawbone.upplatformsdk.oauth'],
        'Java MQTT Client': ['org.eclipse.paho.client.mqttv3'],
        'ImagePicker': ['com.lzy.imagepicker.', 'com.imagepicker'],
        'Horizontal ListView': ['com.devsmart'],
        'HockeyApp': ['net.hockeyapp.android'],
        'Gson': ['org.json', 'com.google.gson'],
        'GrowingIO': ['com.growingio.android.sdk'],
        'GiraffePlayer2': ['tcking.github.com.giraffeplayer2.'],
        'GPUImage': ['jp.co.cyberagent.android.gpuimage'],
        'Foobnix': ['com.foobnix.'],
        'Flurry': ['com.flurry.android'],
        'Floating Action Button': ['com.getbase.floatingactionbutton'],
        'FloatWindow': ['com.yhao.floatwindow'],
        'FirebaseUI': ['com.firebase.ui.'],
        'FilePickerLibrary': ['com.github.developerpaul123.filepickerlibrary.'],
        'FileDownloader': ['com.liulishuo.filedownloader'],
        'Facebook SDK': ['com.facebook.sdk', 'com.facebook.FacebookContent'],
        'Facebook React': ['com.facebook', 'com.facebook.react'],
        'Fabric': ['io.fabric.ApiKey'],
        'Evernote推送': ['com.evernote.android.job.'],
        'Estore iap': ['com.estore.iap.TypaySdkActivity'],
        'EditText in Material Design': ['com.rengwuxian.materialedittext'],
        'EasyPermissions': ['pub.devrel.easypermissions'],
        'EaseUi': ['com.easemob.easeui.ui'],
        'EBookDroid': ['org.ebookdroid.'],
        'E4a': ['com.e4a.runtime'],
        'DownloadService': ['com.ss.android.downloadlib.','com.ss.android.socialbase.downloader','com.ss.android.socialbase.appdownloader'],
        'Double Labs': ['com.doublelabs.'],
        'Disk-based LRU cache': ['com.jakewharton.disklrucache'],
        'Digits': ['com.digits.sdk.android'],
        'DataEye 统计分析': ['com.dataeye.channel'],
        'DCloud': ['io.dcloud.appstream.','io.dcloud.common','io.dcloud.streamdownload', 'io.dcloud'],
        'CustomActivityOnCrash': ['cat.ereza.customactivityoncrash.'],
        'Curzibn_Luban': ['top.zibin.luban'],
        'Crashlytics': ['com.crashlytics'],
        'Cortana SDK': ['com.microsoft.cortana.plugin', 'com.microsoft.cortana.clientsdk', 'com.microsoft.cortana.services', 'com.microsoft.cortana.sdk', 'com.microsoft.cortana.'],
        'Cordova': ['io.github.pwlin.cordova.plugins.', 'org.apache.cordova'],
        'CocosPlay': ['com.chukong.cocosplay'],
        'Cobub Razor': ['com.wbtech.ums'],
        'CloudRail': ['com.cloudrail.si'],
        'Circle button widget': ['at.markushi.ui'],
        'Chuck': ['com.readystatesoftware.chuck'],
        'Chromium': ['org.chromium.base'],
        'CheckVersionLib': ['com.allenliu.versionchecklib'],
        'ByakuGallery': ['com.diegocarloslima.byakugallery.lib'],
        'Bugtag': ['com.bugtags.library.'],
        'Bugsnag': ['com.bugsnag.android.'],
        'Braintree支付': ['com.braintreepayments.api.'],
        'Boku Pay': ['com.boku.mobile.'],
        'Bmob': ['cn.bmob.'],
        'Blankj': ['com.blankj.utilcode'],
        'Bing Search API': ['com.microsoft.bing.commonlib','com.microsoft.bing.visualsearch','com.microsoft.bingsearchsdk','com.microsoft.bsearchsdk','com.microsoft.bing.'],
        'BeeCloud 支付': ['cn.beecloud.'],
        '腾讯灯塔': ['com.tencent.beacon.'],
    }


def padding(data, fixed, text):
    if fixed <= len(data):
        return data
    count = fixed - len(data)
    for i in range(count):
        data += text
    return data


def format_time(time_stamp):
    try:
        time_stampss = time_stamp[:-3]
        temp = time.localtime(int(time_stampss))
        return time.strftime("%Y-%m-%d %H:%M:%S", temp)
    except Exception as e:
        return 1


def format(num, key, msg):
    try:
        count = int(msg['count'] )# msg['second']
        x = padding(str(num), 4, ' ')
        return x + format_time(msg['time_stamp']) + behavior[key]+':' + str(count)
    except Exception as e:
        print(e, sys.exc_info())


def analysis():

    result = list()
    try:
        file = open('message.txt', 'r')
        data = file.readlines()
        file.close()
        content = list()

        for item in data:
                content.append(item.split('\n')[0])

        dynamic = []
        buffer = {}
        stack_buffer = []
        for item in content:
                data = json.loads(item)
                type = data['type']
                if 0 == type:
                        ary = json.loads(data['content'])
                        for it in ary:
                                dynamic.append(it)

                if 1 == type:
                        stack_buffer.append(data['content'])
                        if data['name'] in buffer.keys():
                                info = buffer[data['name']]
                                info['count'] = info['count'] + 1
                                if info['time_stamp'] != data['time_stamp']:
                                        info['time_stamp'] = data['time_stamp']
                                        info['second'] = info['second'] + 1
                                buffer[data['name']] = info
                        else:
                                info = dict()
                                info['count'] = 1
                                info['time_stamp'] = data['time_stamp']
                                info['second'] = 1
                                buffer[data["name"]] = info

        result.append('=====================================================')
        result.append('                     动态申请权限                     ')
        result.append('=====================================================')
        for item in dynamic:
                result.append(item)
        result.append('=====================================================')
        result.append('序号      检测时间       行为及次数(次/秒)            ')
        result.append('=====================================================')
        mum = 0
        for key in buffer.keys():
                result.append(format(mum, key, buffer.get(key)))
                mum = mum + 1
        result.append('=====================================================')

        for item in sdk_dic:
            ary = sdk_dic[item]
            for index in range(len(ary)):
                for temp in stack_buffer:
                    for class_name in temp:
                        if ary[index] in class_name:
                            print(item)
                            break

    except IOError:
        print("Open the file failed")
    return result


def has_sdk(stack):
        ret = []
        for item in sdk_dic:
            ary = sdk_dic[item]
            for index in range(len(ary)):
                for temp in stack:
                    for class_name in temp:
                        if ary[index] in class_name:
                                ret.append(item)
                                break
        return ret


if __name__ == '__main__':
        analysis()
